<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddDivideOrderDiscountToOrderItemTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('el_order_item', function (Blueprint $table) {

            $table->integer('divide_order_discount')->nullable()
                ->default(0)->after('adjustments_total');  //订单折扣平摊到该商品上的金额

            $table->integer('item_discount')->nullable()
                ->default(0)->after('adjustments_total');  //订单商品中的优惠金额
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('el_order_item', function (Blueprint $table) {
            $table->dropColumn(['divide_order_discount','item_discount']);
        });

    }
}
